<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>
<body layadmin-themealias="default">

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body" pad15="">
                    <div class="layui-form" wid100="" lay-filter="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">维护标题</label>
                            <div class="layui-input-block">
                                <input type="text" name="title" value="" class="layui-input" placeholder="请输入维护标题" lay-verify="required">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">维护内容</label>
                            <div class="layui-input-block">
                                <input type="text" name="content" value="" placeholder="请输入维护内容" class="layui-input" lay-verify="required">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">维护终端</label>
                            <div class="layui-input-inline">
                                <select name="device">
                                    {volist name="device_cate" id="vo"}
                                    <option value="{$key}">{$vo}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item" >
                            <label class="layui-form-label">维护时间</label>
                            <div class="layui-input-inline">
                                <input type="text" name="start_time" value="" placeholder="请选择维护时间" autocomplete="off" class="layui-input" lay-verify="required" id="start_time_input">
                            </div>
                            <div class="layui-form-mid">-</div>
                            <div class="layui-input-inline">
                                <input type="text" name="end_time" value="" placeholder="请选择维护时间" autocomplete="off" class="layui-input" lay-verify="required" id="end_time_input">
                            </div>
                        </div>


                        <div class="layui-form-item" >
                            <label class="layui-form-label">提示维护时间</label>
                            <div class="layui-input-inline">
                                <input type="text" name="remind_time" value="" placeholder="请选择提示维护时间" autocomplete="off" class="layui-input" lay-verify="" id="remind_time_input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="maintain-add">确认保存</button>
                                <button class="layui-btn layui-btn-primary layuiadmin-btn-maintain" data-type="cancel">取消</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script src="/assets/cos-js-sdk-v5/cos-js-sdk-v5.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'laydate', 'admin', 'maintain'], function () {
        var $ = layui.$
            , form = layui.form
            , laydate = layui.laydate
            , admin = layui.admin;

        //执行一个laydate实例
        laydate.render({
            elem: '#start_time_input',
            type: 'datetime',
            min: '<?php echo date("Y-m-d H:i:s");?>',
        });
        laydate.render({
            elem: '#end_time_input',
            type: 'datetime',
            min: '<?php echo date("Y-m-d H:i:s");?>',
        });
        laydate.render({
            elem: '#remind_time_input',
            type: 'datetime',
            min: '<?php echo date("Y-m-d H:i:s");?>',
        });

        //事件
        var active = {
            cancel: function(){
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭
            }
        };

        $('.layui-btn.layuiadmin-btn-maintain').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>
</body>
</html>
